#!/usr/bin/env python
# coding: utf-8

from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
from chatterbot.trainers import ListTrainer
from flask import Flask
app = Flask(__name__)
deepthought = ChatBot("deepthought",
storage_adapter='chatterbot.storage.MongoDatabaseAdapter',
database='chatterbot-database',
logic_adapters=[
        {
            "import_path": "chatterbot.logic.BestMatch",
            "statement_comparison_function": "chatterbot.comparisons.levenshtein_distance",
            "response_selection_method": "chatterbot.response_selection.get_first_response"
        }
   				 ]

					  )
deepthought.set_trainer(ChatterBotCorpusTrainer)

#deepthought.train("chatterbot.corpus.chinese")

@app.route('/get/')
@app.route('/get/<input>')
def get(input):
	response = deepthought.get_response(input).text
	return response
if __name__ == '__main__':
    app.run(host='0.0.0.0')